const express = require('express')
const bodyParser = require('body-parser')
const router = require('./router')
const app = express()

// 公开文件
app.use('/node_modules', express.static('./node_modules'))
app.use('/public', express.static('./public'))

// 配置模板引擎
app.engine('html', require('express-art-template'))

// 配置bodyParser
app.use(bodyParser.urlencoded({
  extended: false
}))
app.use(bodyParser.json())

// 挂载路由到app上
app.use(router)

// 监听端口
app.listen(3000, () => {
  console.log('server is running...')
})